import type { TAdminReq, TAdminDisableReq } from "@/typing/admin";
import type { TListReq } from "@/typing/base";
import alovaInstance from "@/utils/request";

export const queryAdminList = (req?: TListReq | Pick<TAdminReq, 'nickname' | 'username' | 'mobile'>) => alovaInstance.Get('/api/admin', { params: req })
export const createAdmin = (req: TAdminReq) => alovaInstance.Post('/api/admin', req)
export const disabledAdmin = (req: TAdminDisableReq) => alovaInstance.Patch('/api/admin/used', req)
export const deleteAdmin = (req: Pick<TAdminDisableReq, 'id'>) => alovaInstance.Delete(`/api/admin/${req.id}`)
export const queryAdminMenu = (id: string) => alovaInstance.Get(`/api/admin/menu/${id}`)
export const editAdminMenu = (req: Record<'id' & 'actions', string>) => alovaInstance.Post('/api/admin/menu', req)
